/***************************************************************************
 **
 **  Copyright (C) 2021 MaMinJie <canpool@163.com>
 **  Contact: https://github.com/canpool
 **           https://gitee.com/icanpool
 **
 **  GNU Lesser General Public License Usage
 **  Alternatively, this file may be used under the terms of the GNU Lesser
 **  General Public License version 3 as published by the Free Software
 **  Foundation and appearing in the file LICENSE.LGPL3 included in the
 **  packaging of this file. Please review the following information to
 **  ensure the GNU Lesser General Public License version 3 requirements
 **  will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
 **
 **  GNU General Public License Usage
 **  Alternatively, this file may be used under the terms of the GNU
 **  General Public License version 2.0 or (at your option) the GNU General
 **  Public license version 3 or any later version approved by the KDE Free
 **  Qt Foundation. The licenses are as published by the Free Software
 **  Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
 **  included in the packaging of this file. Please review the following
 **  information to ensure the GNU General Public License requirements will
 **  be met: https://www.gnu.org/licenses/gpl-2.0.html and
 **  https://www.gnu.org/licenses/gpl-3.0.html.
 **
****************************************************************************/
#ifndef LITERIBBONPAGE_H
#define LITERIBBONPAGE_H

#include <QWidget>
#include "qlite_global.h"

QLITE_BEGIN_NAMESPACE

class LiteRibbonGroup;
class LiteRibbonPagePrivate;

/* LiteRibbonPage */
class QLITE_SHARED_EXPORT LiteRibbonPage : public QWidget
{
    Q_OBJECT
public:
    explicit LiteRibbonPage(QWidget *parent = Q_NULLPTR);
    virtual ~LiteRibbonPage();

    void addGroup(LiteRibbonGroup *group);
    LiteRibbonGroup *addGroup(const QString &title);
    LiteRibbonGroup *addGroup(const QIcon &icon, const QString &title);

    void insertGroup(int index, LiteRibbonGroup *group);
    LiteRibbonGroup *insertGroup(int index, const QString &title);
    LiteRibbonGroup *insertGroup(int index, const QIcon &icon, const QString &title);

    void removeGroup(LiteRibbonGroup *group);
    void removeGroupByIndex(int index);

    void detachGroup(LiteRibbonGroup *group);
    void detachGroupByIndex(int index);

    void clearGroups();

    QAction *defaultAction() const;

    int groupCount() const;
    LiteRibbonGroup *groupAt(int index) const;
    int groupIndex(LiteRibbonGroup *group) const;
    QList<LiteRibbonGroup *> groups() const;

    const QString &title() const;

Q_SIGNALS:
    void titleChanged(const QString &title);

public Q_SLOTS:
    void setTitle(const QString &title);

protected:
//    virtual bool event(QEvent *event);
//    virtual void paintEvent(QPaintEvent *event);
//    virtual void changeEvent(QEvent *event);
    virtual void resizeEvent(QResizeEvent *event);

private:
    LiteRibbonPagePrivate *d;
};

QLITE_END_NAMESPACE

#endif // LITERIBBONPAGE_H
